home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / gfa / gfaexprt.lzh / GFAXPERT.LIB / PRINTER.LST < prev    next >
Encoding:
File List  |  1986-10-19  |  12.4 KB  |  484 lines

  1. ' *******************
  2. ' *** PRINTER.LST ***
  3. ' *******************
  4. '
  5. DEFWRD "a-z"
  6. '
  7. > PROCEDURE printer.ready
  8.   ' *** test if printer ready
  9.   LOCAL k
  10.   DO
  11.     EXIT IF GEMDOS(&H11)
  12.     SOUND 1,10,12,4,25
  13.     SOUND 1,10,6,4,25
  14.     SOUND 1,10,12,4,50
  15.     SOUND 1,0
  16.     ALERT 3," printer| | not ready !!",1," OK ",k
  17.   LOOP
  18. RETURN
  19. ' **********
  20. '
  21. > PROCEDURE initio.epson.fx80
  22.   ' *** initialize global printer-variables for Epson FX-80
  23.   '
  24.   lf$=CHR$(10)
  25.   ff$=CHR$(12)
  26.   bs$=CHR$(8)
  27.   '
  28.   DEFFN right.margin$(n)=CHR$(27)+"Q"+CHR$(n)
  29.   DEFFN left.margin$(n)=CHR$(27)+"l"+CHR$(n)
  30.   DEFFN bit.image.8$(mode,dots)=CHR$(27)+"*"+CHR$(mode)+CHR$(dots MOD 256)+CHR$(dots\256)
  31.   DEFFN line.space$(n)=CHR$(27)+"3"+CHR$(n)     ! n/216 inch (default 32/216)
  32.   '
  33.   elite$=CHR$(27)+"M"
  34.   pica$=CHR$(27)+"P"
  35.   proportional.on$=CHR$(27)+"p"+CHR$(1)
  36.   proportional.off$=CHR$(27)+"p"+CHR$(0)
  37.   enlarged.on$=CHR$(27)+"W"+CHR$(1)
  38.   enlarged.off$=CHR$(27)+"W"+CHR$(0)
  39.   condensed.on$=CHR$(15)
  40.   condensed.off$=CHR$(18)
  41.   emphasized.on$=CHR$(27)+"E"
  42.   emphasized.off$=CHR$(27)+"F"
  43.   italic.on$=CHR$(27)+"4"
  44.   italic.off$=CHR$(27)+"5"
  45.   underline.on$=CHR$(27)+"-"+CHR$(1)
  46.   underline.off$=CHR$(27)+"-"+CHR$(0)
  47.   '
  48.   unidirectional$=CHR$(27)+"U"+CHR$(1)
  49.   bidirectional$=CHR$(27)+"U"+CHR$(0)
  50.   '
  51.   initialize$=CHR$(27)+"@"
  52.   '
  53. RETURN
  54. ' **********
  55. '
  56. > PROCEDURE high.screendump.epson.fx80
  57.   ' *** screendump to Epson FX-80 (correct height/width ratio)
  58.   ' *** High-resolution only
  59.   ' *** uses Standard Globals
  60.   LOCAL m$,b$,k,scrn.start%,col,b%,x,d%,p
  61.   IF high.res!
  62.     m$=" this screendump will| take about 2 minutes"
  63.     m$=m$+"| (abort dump with <Esc>)"
  64.     b$=" OK | Abort "
  65.     ALERT 1,m$,1,b$,k
  66.     IF k=1
  67.       DO
  68.         EXIT IF GEMDOS(&H11)
  69.         m$=" printer| | not ready !!"
  70.         b$=" OK "
  71.         SOUND 1,10,12,4,25
  72.         SOUND 1,10,6,4,25
  73.         SOUND 1,10,12,4,50
  74.         SOUND 1,0
  75.         ALERT 3,m$,1,b$,k
  76.       LOOP
  77.       HIDEM
  78.       '
  79.       lf$=CHR$(10)
  80.       ff$=CHR$(12)
  81.       DEFFN bit.image.8$(mode,dots)=CHR$(27)+"*"+CHR$(mode)+CHR$(MOD(dots,256))+CHR$(dots/256)
  82.       DEFFN line.space$(n)=CHR$(27)+"3"+CHR$(n)    ! n/216 inch (default 32/216)
  83.       initialize$=CHR$(27)+"@"
  84.       scrn.start%=XBIOS(2)
  85.       '
  86.       LPRINT initialize$;
  87.       LPRINT lf$;lf$
  88.       FOR col=0 TO 79
  89.         b%=scrn.start%+col
  90.         LPRINT SPC(12);
  91.         LPRINT @line.space$(24);      ! 8 dots/line
  92.         LPRINT @bit.image.8$(5,400);  ! 72 dots/inch ("plotter") ; 400 dots/line
  93.         FOR x=399 TO 0 STEP -1
  94.           d%=ADD(b%,MUL(x,80))
  95.           p=BYTE{d%}
  96.           OUT 0,p
  97.         NEXT x
  98.         LPRINT
  99.         EXIT IF INKEY$=esc$
  100.       NEXT col
  101.       LPRINT ff$;
  102.       LPRINT initialize$;
  103.     ENDIF
  104.   ELSE
  105.     m$="Sorry,|High rez|only !!"
  106.     ALERT 3,m$,1," OK ",k
  107.   ENDIF
  108. RETURN
  109. ' **********
  110. '
  111. > PROCEDURE download.epson.fx80
  112.   ' *** put original Epson ROM-characters in Download Character Set
  113.   LPRINT CHR$(27);":";CHR$(0);CHR$(0);CHR$(0);
  114.   ' *** select Download Character Set for printing
  115.   LPRINT CHR$(27);"%";CHR$(1);CHR$(0);
  116.   ' *** load new characters into RAM of Epson-printer
  117.   ' *** download 32-126 (ASCII) or 160-254
  118.   ' *** in last case no italics possible !
  119.   ' *** attribute 139 if no descender; otherwise 11 ("lower" 8 dots of 9)
  120.   RESTORE dwnload.characters
  121.   READ code
  122.   REPEAT
  123.     READ attribute
  124.     LPRINT CHR$(27);"&";CHR$(0);CHR$(code);CHR$(code);CHR$(attribute);
  125.     FOR n=1 TO 11
  126.       READ bit.pattern
  127.       LPRINT CHR$(bit.pattern);
  128.     NEXT n
  129.     READ code
  130.   UNTIL code<0
  131.   '
  132.   ' *** ASCII-code, attribute, 11 bit-patterns; 12th bit-pattern always 0
  133.   dwnload.characters:
  134.   DATA 160,139
  135.   DATA 0,4,10,32,10,96,138,32,28,2,0
  136.   DATA 161,139
  137.   DATA 0,0,18,0,94,128,2,0,0,0,0
  138.   DATA 162,139
  139.   DATA 0,28,34,0,34,64,162,0,34,28,0
  140.   DATA 163,139
  141.   DATA 0,60,2,0,66,128,2,0,60,2,0
  142.   DATA 171,139
  143.   DATA 0,0,248,2,12,48,194,20,34,8,50
  144.   DATA 172,139
  145.   DATA 0,0,248,2,12,48,204,16,36,75,4
  146.   DATA 189,139
  147.   DATA 0,56,68,0,186,68,170,0,68,56,0
  148.   DATA 221,139
  149.   DATA 0,0,80,170,0,170,0,170,20,0,0
  150.   DATA 222,139
  151.   DATA 0,8,0,16,0,32,0,16,0,8,0
  152.   DATA 223,139
  153.   DATA 0,16,40,0,32,16,8,0,40,16,0
  154.   DATA 227,139
  155.   DATA 0,32,64,62,64,32,0,62,64,0,0
  156.   DATA 228,139
  157.   DATA 0,130,68,170,16,130,0,130,0,130,0
  158.   DATA 240,139
  159.   DATA 0,73,0,73,0,73,0,73,0,73,0
  160.   DATA 241,139
  161.   DATA 0,17,0,17,0,125,0,17,0,17,0
  162.   DATA 242,139
  163.   DATA 0,0,131,0,69,0,41,0,17,0,0
  164.   DATA 243,139
  165.   DATA 0,0,17,0,41,0,69,0,131,0,0
  166.   DATA 247,139
  167.   DATA 0,36,72,0,72,36,18,0,18,36,0
  168.   DATA 248,139
  169.   DATA 0,0,0,64,160,0,160,64,0,0,0
  170.   DATA 251,139
  171.   DATA 0,0,32,16,8,16,32,64,128,0,128
  172.   DATA 253,139
  173.   DATA 0,0,0,72,144,8,160,8,192,8,0
  174.   DATA 254,139
  175.   DATA 0,0,16,136,0,168,0,168,80,0,0
  176.   DATA -1
  177. RETURN
  178. ' **********
  179. '
  180. > PROCEDURE initio.star24
  181.   ' *** initializes global printer-variables for Star LC24-10
  182.   ' *** consult your printer-manual for the following (and other) commands
  183.   ' *** DIP-switch settings :
  184.   '     1-1 OFF         2-1 ON
  185.   '     1-2 ON          2-2 ON
  186.   '     1-3 OFF         2-3 ON
  187.   '     1-4 ON          2-4 ON
  188.   '     1-5 ON          2-5 OFF
  189.   '     1-6 ON          2-6 OFF
  190.   '     1-7 ON          2-7 ON
  191.   '     1-8 ON          2-8 ON
  192.   '
  193.   LOCAL c$,f$
  194.   '
  195.   c$=CHR$(27)
  196.   f$=CHR$(28)
  197.   '
  198.   draft.char$=c$+"x0"
  199.   lq.char$=c$+"x1"
  200.   '
  201.   courier.style$=c$+"k0"+lq.char$
  202.   prestige.style$=c$+"k2"+lq.char$
  203.   orator.style$=c$+"k3"+lq.char$
  204.   script.style$=c$+"k4"+lq.char$
  205.   '
  206.   normal.char$=c$+"q0"
  207.   outlined.char$=c$+"q1"
  208.   shadow.char$=c$+"q2"
  209.   outlined.shadow.char$=c$+"q3"
  210.   '
  211.   italic.on$=c$+"4"
  212.   italic.off$=c$+"5"
  213.   '
  214.   emphasized.on$=c$+"E"
  215.   emphasized.off$=c$+"F"
  216.   '
  217.   LET double.on$=c$+"G"
  218.   LET double.off$=c$+"H"
  219.   '
  220.   underline.on$=c$+"-1"
  221.   underline.off$=c$+"-0"
  222.   overline.on$=c$+"_1"
  223.   overline.off$=c$+"_0"
  224.   '
  225.   bold.draft$=draft.char$+emphasized.on$+double.on$
  226.   bold.lq$=lq$+double.on$
  227.   bold.off$=emphasized.off$+double.off$
  228.   '
  229.   superscript.on$=c$+"S0"
  230.   superscript.off$=c$+"T"
  231.   subscript.on$=c$+"S1"
  232.   subscript.off$=c$+"T"
  233.   '
  234.   DEFFN international.set$(n)=c$+"R"+CHR$(n)
  235.   usa.set=0
  236.   france.set=1
  237.   germany.set=2
  238.   england.set=3
  239.   denmark1.set=4
  240.   sweden.set=5
  241.   italy.set=6
  242.   spain1.set=7
  243.   japan.set=8
  244.   norway.set=9
  245.   denmark2.set=10
  246.   spain2.set=11
  247.   latin.set=12
  248.   denmark.norway.set=13
  249.   '
  250.   epson.set$=c$+"t0"
  251.   ibm.set$=c$+"t1"+c$+"6"
  252.   DEFFN special.on$(n)=c$+"\"+CHR$(MOD(n,256))+CHR$(DIV(n,256))
  253.   DEFFN ibm.special$(n)=c$+"^"+CHR$(n)
  254.   DEFFN epson.special$(n)=ibm.set$+@ibm.special$(n)+epson.set$  ! 0 ≤ n ≤ 32
  255.   '
  256.   slash.zero$=c$+"~1"
  257.   normal.zero$=c$+"~0"
  258.   '
  259.   pica$=c$+"P"
  260.   '
  261.   elite$=c$+"M"
  262.   high.speed.elite$=draft.char$+elite$+f$+"S1"
  263.   high.density.elite$=draft.char$+elite$+f$+"S0"
  264.   '
  265.   semi.condensed$=c$+"g"
  266.   condensed.on$=CHR$(15)
  267.   condensed.off$=CHR$(18)
  268.   '
  269.   large.on$=c$+"W1"
  270.   large.off$=c$+"W0"
  271.   large.line$=CHR$(14)
  272.   '
  273.   courier.proportional$=courier.style$+c$+"p1"
  274.   prestige.proportional$=prestige.style$+c$+"p1"
  275.   proportional.off$=c$+"p0"
  276.   '
  277.   DEFFN master.mode$(n)=c$+"!"+CHR$(n)
  278.   underline=128
  279.   italic=64
  280.   expanded=32
  281.   LET double.strike=16
  282.   emphasized=8
  283.   condensed=4
  284.   proportional=2
  285.   elite=1
  286.   '
  287.   DEFFN increase.space$(n)=c$+" "+CHR$(n)
  288.   '
  289.   normal.size$=c$+"h"+CHR$(0)
  290.   LET double.size$=c$+"h"+CHR$(1)
  291.   quad.size$=c$+"h"+CHR$(2)
  292.   LET double.height$=c$+"w1"
  293.   normal.height$=c$+"w0"
  294.   normal.width$=f$+"E"+CHR$(0)
  295.   LET double.width$=f$+"E"+CHR$(1)
  296.   triple.width$=f$+"E"+CHR$(2)
  297.   '
  298.   lf$=CHR$(10)
  299.   DEFFN lf$(n)=c$+"f1"+CHR$(n)
  300.   rev.lf$=c$+CHR$(10)
  301.   '
  302.   ff$=CHR$(12)
  303.   rev.ff$=c$+CHR$(12)
  304.   '
  305.   DEFFN top.margin$(t)=c$+"c"+CHR$(t)
  306.   DEFFN bottom.margin$(b)=c$+"N"+CHR$(b)
  307.   cancel.tb.margins$=c$+"O"
  308.   '
  309.   DEFFN set.margins$(l,r)=c$+"X"+CHR$(l)+CHR$(r)
  310.   DEFFN all.margins$(t,b,l,r)=@top.margin$(t)+@bottom.margin$(b)+@set.margins$(l,r)
  311.   '
  312.   justify.left$=c$+"a0"
  313.   justify.right$=c$+"a2"
  314.   justify.full$=c$+"a3"
  315.   center$=c$+"a1"
  316.   '
  317.   immediate.on$=c$+"i1"
  318.   immediate.off$=c$+"i0"
  319.   '
  320.   off.line$=CHR$(19)
  321.   on.line$=CHR$(17)
  322.   '
  323.   bidirectional$=c$+"U0"
  324.   unidirectional$=c$+"U1"
  325.   '
  326.   reset$=c$+"@"
  327.   '
  328. RETURN
  329. ' **********
  330. '
  331. > PROCEDURE high.screendump.star24
  332.   ' *** screendump to Star LC24-10 (actually larger than screen !)
  333.   ' *** each byte 'enlarged' to 3 bytes (1 set bit -> 3 bits)
  334.   ' *** High-resolution only
  335.   ' *** uses Standard Globals
  336.   LOCAL m$,b$,k,scrn.start%,col,b%,x,d%,p|,b1|,b2|,b3|,n
  337.   IF high.res!
  338.     m$=" screendump| will last| several minutes"
  339.     m$=m$+"| (abort dump with <Esc>)"
  340.     b$=" OK | Abort "
  341.     ALERT 1,m$,1,b$,k
  342.     IF k=1
  343.       DO
  344.         EXIT IF GEMDOS(&H11)
  345.         m$=" printer| | not ready !!"
  346.         b$=" OK "
  347.         SOUND 1,10,12,4,25
  348.         SOUND 1,10,6,4,25
  349.         SOUND 1,10,12,4,50
  350.         SOUND 1,0
  351.         ALERT 3,m$,1,b$,k
  352.       LOOP
  353.       HIDEM
  354.       '
  355.       lf$=CHR$(10)
  356.       ff$=CHR$(12)
  357.       DEFFN bit.image$(mode,dots)=CHR$(27)+"*"+CHR$(mode)+CHR$(MOD(dots,256))+CHR$(dots/256)
  358.       DEFFN line.space$(n)=CHR$(27)+"3"+CHR$(n)    ! n/216 inch (default 32/216)
  359.       initialize$=CHR$(27)+"@"
  360.       scrn.start%=XBIOS(2)
  361.       '
  362.       LPRINT initialize$;
  363.       FOR col=0 TO 79
  364.         b%=scrn.start%+col
  365.         LPRINT SPC(8);              ! Elite-mode !!
  366.         LPRINT @line.space$(24);    ! 24 dots/line
  367.         LPRINT @bit.image$(33,800); ! 120 dots/inch (double) ; 2x400 dots/line
  368.         FOR x=399 TO 0 STEP -1
  369.           d%=ADD(b%,MUL(x,80))
  370.           p|=BYTE{d%}
  371.           IF p|=0
  372.             OUT 0,0,0,0,0,0,0
  373.           ELSE
  374.             CLR b1|,b2|,b3|
  375.             IF BTST(p|,0)
  376.               b1|=7
  377.             ENDIF
  378.             IF BTST(p|,1)
  379.               ADD b1|,56
  380.             ENDIF
  381.             IF BTST(p|,2)
  382.               ADD b1|,192
  383.               b2|=1
  384.             ENDIF
  385.             IF BTST(p|,3)
  386.               ADD b2|,14
  387.             ENDIF
  388.             IF BTST(p|,4)
  389.               ADD b2|,112
  390.             ENDIF
  391.             IF BTST(p|,5)
  392.               ADD b2|,128
  393.               b3|=3
  394.             ENDIF
  395.             IF BTST(p|,6)
  396.               ADD b3|,28
  397.             ENDIF
  398.             IF BTST(p|,7)
  399.               ADD b3|,224
  400.             ENDIF
  401.             OUT 0,b3|,b2|,b1|,b3|,b2|,b1|
  402.           ENDIF
  403.         NEXT x
  404.         LPRINT
  405.         EXIT IF INKEY$=esc$
  406.       NEXT col
  407.       LPRINT ff$;
  408.       LPRINT initialize$;
  409.     ENDIF
  410.   ELSE
  411.     m$="Sorry,|High rez|only !!"
  412.     ALERT 3,m$,1," OK ",k
  413.   ENDIF
  414. RETURN
  415. ' **********
  416. '
  417. > PROCEDURE degas.screendump.star24
  418.   ' *** use Degas printer-driver for screendump of logical screen
  419.   ' *** drivers (2000 bytes) have to be loaded into INLINE-lines
  420.   ' *** this Procedure uses drivers for the Star LC24-10 printer
  421.   ' *** uses Procedures Make.palette.string and Printer.ready
  422.   LOCAL buffer%,palet$,palet%,rez,screen%,command,r%,m$,k,large!
  423.   '
  424.   ' *** load LARGE.INL here
  425.   INLINE star24.large.driver%,2000
  426.   '
  427.   ' *** load SMALL.INL here
  428.   INLINE star24.small.driver%,2000
  429.   '
  430.   ERASE buffer|()
  431.   DIM buffer|(1279)
  432.   buffer%=V:buffer|(0)
  433.   @make.palette.string(palet$)
  434.   palet%=V:palet$
  435.   rez=XBIOS(4)
  436.   screen%=XBIOS(3)
  437.   command=0
  438.   @printer.ready
  439.   m$="screendump| |1 - LARGE|2 - SMALL"
  440.   ALERT 3,m$,0," 1 | 2 ",k
  441.   IF k=1
  442.     large!=TRUE
  443.     m$="<Alternate>|for 18x11 cm,|default size|is 27x17 cm"
  444.     ALERT 3,m$,1," OK ",k
  445.     r%=C:star24.large.driver%(command,rez,L:screen%,L:palet%,L:buffer%)
  446.   ELSE
  447.     large!=FALSE
  448.     m$="<Alternate>|for 9x5.5 cm,|default size|is 13.5x8.5 cm"
  449.     ALERT 3,m$,1," OK ",k
  450.     r%=C:star24.small.driver%(command,rez,L:screen%,L:palet%,L:buffer%)
  451.   ENDIF
  452.   SELECT BYTE(r%)
  453.   CASE 0
  454.     m$="Sorry, can't|initialize|printer driver|   ???"
  455.     ALERT 3,m$,1,"EDIT",k
  456.     EDIT
  457.   CASE 1
  458.     m$="Abort this|screendump|with <Undo>"
  459.     ALERT 1,m$,1," OK ",k
  460.     command=1
  461.     IF large!
  462.       r%=C:star24.large.driver%(command,rez,L:screen%,L:palet%,L:buffer%)
  463.     ELSE
  464.       r%=C:star24.small.driver%(command,rez,L:screen%,L:palet%,L:buffer%)
  465.     ENDIF
  466.   DEFAULT
  467.     m$="Printer driver|does not|function|   ???"
  468.     ALERT 3,m$,1,"EDIT",k
  469.     EDIT
  470.   ENDSELECT
  471. RETURN
  472. ' **********
  473. '
  474. > PROCEDURE screendump
  475.   ' *** printer-parameters changed with Xbios 33 (Setprt)
  476.   ' *** set for : matrixprinter, monochrome, 960 dots/line, draft,
  477.   ' ***           parallel, fanfold paper
  478.   ' *** height/width ratio of screendump does not correspond with screen !
  479.   ~XBIOS(33,&X100)
  480.   HARDCOPY
  481. RETURN
  482. ' **********
  483. '
  484.